package com.day9.test3_digui;

/**
 * @author 小坡
 * @date 2022/9/12  17:30
 **/
public class MyFactorial2 {
    //    使用递归
    public static void main(String[] args) {
        int sum = getSum(100);
        System.out.println(sum);
    }

    private static int getSum(int i) {
        if (i == 1) {
            return 1;
        } else {
            return i + getSum(i - 1);
        }
    }
}
